#!/bin/bash

# 打包Window平台脚本
set CGO_ENABLED=0 
set GOOS=windows 
set GOARCH=386
set CGO_CXXFLAGS="./libs/webview2/build/native/include"
set CGO_LDFLAGS="./libs/webview2/build/native/x64"

# go build -o build/bin/lucidity-note.exe main.go
go build -ldflags="-H windowsgui" -o build/bin/lucidity-note.exe main.go

set CGO_ENABLED=1
set GOOS=linux 
set GOARCH=amd64 
set CGO_CXXFLAGS="-g -O2"
set CGO_FFLAGS="-g -O2"

# 创建快捷方式
cp -f logo.png ./build

# 报错:还未解决 # command-line-arguments
# /usr/lib/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
# g++: error: unrecognized command-line option ‘-mwindows’

# To cross compile for windows you would need mingw-w64 or use 
# i686-w64-mingw32-g++ sudo apt-get install mingw-w64 
# sudo apt-get install mingw-w64 
# yay -S mingw-w64 